<?php

namespace app\api\model;

use think\Model;
use think\Db;

/**
 * 模型
 */
class OrderGoodsAdd extends Model
{
    // 表名
    protected $name = 'shop_order_goods_add';
    // 开启自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';
    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = '';

    public function goods()
    {
        return $this->belongsTo('Goods', 'goods_id', 'id', [], 'LEFT')->setEagerlyType(1);
    }

    public function Sku()
    {
        return $this->belongsTo('Sku', 'goods_sku_id', 'id', [], 'LEFT');
    }

    public function Order()
    {
        return $this->hasOne('OrderAdd', 'order_sn', 'order_sn', [], 'LEFT');
    }
}